﻿using rbac.domain.Entity;
using rbac.domain.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace rbac.domain.Impl
{
    public class UserRepository : IUserRepository
    {
        private readonly RbacContext _context;

        public UserRepository(RbacContext context)
        {
            _context = context;
        }

        public IQueryable<Userinfo> GetUsers()
        {
            return _context.Userinfo;
        }

        public Userinfo? Login(string userName, string pwd)
        {
            return _context.Userinfo.FirstOrDefault(p => p.UserName == userName
            && p.Password == pwd);
        }
    }
}
